﻿using Compass.Wasm.Shared.Categories;
using Compass.Wasm.Shared.Purchases;
using Compass.Wasm.Shared.Wms;
using Zack.DomainCommons.Models;

namespace Compass.PurchaseService.Domain.Entities;

public record NavItem:AggregateRootEntity
{
    public string Number { get; private set; }
    public string? Description { get; private set; }
    public string? EnDescription { get; private set; }
    public Unit_e Unit { get; private set; }
    public Sbu_e Sbu { get; private set; }
    public Group_e Group { get; private set; }
    public bool Consumable { get; private set; }
    public double SafetyStock { get; private set; }
    public double Inventory { get; private set; }
    public double UnitCost { get; private set; }
    public double LastCost { get; private set; }
    public double UnitPrice { get; private set; }
    public string? Vendor { get; private set; }
    public int OpenPo { get; set; }

    private NavItem() { }

    public NavItem(Guid id, string number, string? description, string? enDescription, Unit_e unit, Sbu_e sbu, Group_e group, bool consumable, double safetyStock, double inventory, double unitCost, double lastCost,double unitPrice,string? vendor,int openPo)

    {
        Id=id;
        Number=number;
        Description=description; 
        EnDescription=enDescription;
        Unit = unit;
        Sbu=sbu;
        Group=group;
        Consumable=consumable;
        SafetyStock=safetyStock;
        Inventory=inventory;
        UnitCost=unitCost;
        LastCost=lastCost;
        UnitPrice=unitPrice;
        Vendor=vendor;
        OpenPo=openPo;
    }


    #region Update
    public void Update(NavItemDto dto)
    {
        ChangeNumber(dto.Number)
            .ChangeDescription(dto.Description)
            .ChangeEnDescription(dto.EnDescription)
            .ChangeUnit(dto.Unit)
            .ChangeSbu(dto.Sbu)
            .ChangeGroup(dto.Group)
            .ChangeConsumable(dto.Consumable)
            .ChangeSafetyStock(dto.SafetyStock)
            .ChangeInventory(dto.Inventory)
            .ChangeUnitCost(dto.UnitCost)
            .ChangeLastCost(dto.LastCost)
            .ChangeUnitPrice(dto.UnitPrice)
            .ChangeVendor(dto.Vendor)
            .ChangeOpenPo(dto.OpenPo);

        NotifyModified();
    }

    public NavItem ChangeNumber(string number)
    {
        Number=number;
        return this;
    }
    public NavItem ChangeDescription(string? description)
    {
        Description=description;
        return this;
    }
    public NavItem ChangeEnDescription(string? enDescription)
    {
        EnDescription=enDescription;
        return this;
    }
    public NavItem ChangeUnit(Unit_e unit)
    {
        Unit=unit;
        return this;
    }
    public NavItem ChangeSbu(Sbu_e sbu)
    {
        Sbu=sbu;
        return this;
    }
    public NavItem ChangeGroup(Group_e group)
    {
        Group=group;
        return this;
    }

    public NavItem ChangeConsumable(bool consumable)
    {
        Consumable= consumable;
        return this;
    }

    public NavItem ChangeSafetyStock(double safetyStock)
    {
        SafetyStock= safetyStock;
        return this;
    }
    public NavItem ChangeInventory(double inventory)
    {
        Inventory= inventory;
        return this;
    }
    public NavItem ChangeUnitCost(double unitCost)
    {
        UnitCost= unitCost;
        return this;
    }
    public NavItem ChangeLastCost(double lastCost)
    {
        LastCost= lastCost;
        return this;
    }
    public NavItem ChangeUnitPrice(double unitPrice)
    {
        UnitPrice= unitPrice;
        return this;
    }
    public NavItem ChangeVendor(string? vendor)
    {
        Vendor= vendor;
        return this;
    }
    public NavItem ChangeOpenPo(int openPo)
    {
        OpenPo= openPo;
        return this;
    }
    #endregion



}

